package com.ruoyi.project.warehouseSystem.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.warehouseSystem.domain.CWarehouseMessage;
import com.ruoyi.project.warehouseSystem.service.ICWarehouseMessageService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 不同仓库的存储量查询Controller
 * 
 * @author wangshuo
 * @date 2021-07-18
 */
@RestController
@RequestMapping("/warehouseSystem/infomation")
public class CWarehouseMessageController extends BaseController
{
    @Autowired
    private ICWarehouseMessageService cWarehouseMessageService;

    /**
     * 查询不同仓库的存储量查询列表
     */
    @PreAuthorize("@ss.hasPermi('warehouseSystem:infomation:list')")
    @GetMapping("/list")
    public TableDataInfo list(CWarehouseMessage cWarehouseMessage)
    {
        startPage();
        List<CWarehouseMessage> list = cWarehouseMessageService.selectCWarehouseMessageList(cWarehouseMessage);
        return getDataTable(list);
    }

    /**
     * 导出不同仓库的存储量查询列表
     */
    @PreAuthorize("@ss.hasPermi('warehouseSystem:infomation:export')")
    @Log(title = "不同仓库的存储量查询", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(CWarehouseMessage cWarehouseMessage)
    {
        List<CWarehouseMessage> list = cWarehouseMessageService.selectCWarehouseMessageList(cWarehouseMessage);
        ExcelUtil<CWarehouseMessage> util = new ExcelUtil<CWarehouseMessage>(CWarehouseMessage.class);
        return util.exportExcel(list, "infomation");
    }

    /**
     * 获取不同仓库的存储量查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('warehouseSystem:infomation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(cWarehouseMessageService.selectCWarehouseMessageById(id));
    }

    /**
     * 新增不同仓库的存储量查询
     */
    @PreAuthorize("@ss.hasPermi('warehouseSystem:infomation:add')")
    @Log(title = "不同仓库的存储量查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CWarehouseMessage cWarehouseMessage)
    {
        return toAjax(cWarehouseMessageService.insertCWarehouseMessage(cWarehouseMessage));
    }

    /**
     * 修改不同仓库的存储量查询
     */
    @PreAuthorize("@ss.hasPermi('warehouseSystem:infomation:edit')")
    @Log(title = "不同仓库的存储量查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CWarehouseMessage cWarehouseMessage)
    {
        return toAjax(cWarehouseMessageService.updateCWarehouseMessage(cWarehouseMessage));
    }

    /**
     * 删除不同仓库的存储量查询
     */
    @PreAuthorize("@ss.hasPermi('warehouseSystem:infomation:remove')")
    @Log(title = "不同仓库的存储量查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(cWarehouseMessageService.deleteCWarehouseMessageByIds(ids));
    }
}
